import Polyglot from 'node-polyglot'

export const translations = {
    'en_US': {
        trigger_code_detection: 'trigger code detection task',
        trigger_result: 'trigger result',
        trigger_failed: 'trigger failed, error message',
        waiting_for_scan_results: 'waiting for scan results',
        scan_results: 'scan results',
    },
    'zh_CN': {
        trigger_code_detection: '触发代码检测任务',
        trigger_result: '触发结果',
        trigger_failed: '触发失败,错误信息',
        waiting_for_scan_results: '等待扫描结果',
        scan_results: '扫描结果',
    }
}

const locale = process.env['PIPELINE_LOCALE'] === 'zh_CN' ? 'zh_CN' : 'en_US'
export const polyglot = new Polyglot({
    interpolation: {prefix: '{{', suffix: '}}'},
    phrases: translations[locale]
})